﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace TestGenerator.Output
{
    public class OutputTestCreator
    {
        private int CurrentTestNum;

        OutputTestCreator()
        {
            CurrentTestNum = 0;
        }

        public void CreateNextTest()
        {
            WriteHeader("test001");
            WriteQuestions("test001");
        }

        private void WriteHeader(string fileName) 
        {
            using (StreamWriter writer = new StreamWriter(fileName))
            {
                string headerString = "";
                writer.Write(headerString);
                writer.Flush();
            }
        }

        private void WriteQuestions(string fileName)
        {
            using (StreamWriter writer = new StreamWriter(fileName))
            {
                string headerString = "";
                headerString = headerString.Replace(
                    ">Вариант ###</p>", ">Вариант " + CurrentTestNum.ToString().PadLeft(3, '0') + "</p>");
                writer.Write(headerString);
                writer.Flush();
            }
        }
    }
}
